package com.ykt.controller;

import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.activerecord.Record;
import com.ykt.model.UserFeedback;

@ControllerBind(controllerKey="/userFeedback")
public class UserFeedbackController extends BaseController<UserFeedback> {

	public UserFeedbackController() {
		super(UserFeedback.class);
	}
	
	@Override
	public void view() {
        Long id = this.getParaToLong(0, 0L);
        if (id != null && id != 0L){
        	String sql = "SELECT u.name userName,u.phone userPhone, "
            		+ "uf.id,uf.email,uf.feedback, uf.created_time "
        			+ " FROM `user_feedback` uf left join `user` u on uf.user_id = u.id "
            		+ " WHERE uf.id=? ";
        	UserFeedback uf = UserFeedback.dao.findFirst(sql,id);
            this.setAttr("po", uf);
        }else{
            this.setAttr("po", new Record());
            }
    }
}
